package com.jappyframework;

/**
 * An assorted collection of utility functions for dealing with Strings
 * 
 * @author harsh
 */
public class StringUtils {

	/**
	 * Capitalize the first character and return. All the remaining characters are De-capitalized.
	 * 
	 * @param s
	 * @return
	 */
	public static String capitalizeFirstCharacter(String s) {
		if (s.length() == 0)
			return s;
		return Character.toUpperCase(s.charAt(0))
				+ s.substring(1).toLowerCase();
	}

	/**
	 * Check sanity for the passed arguments. Throw exception if null
	 * or empty argument was passed.
	 * 
	 * @param args
	 */
	public static void checkSanity(String ... args) {
		for (String arg : args) {
			if (arg == null || arg.trim().length() == 0) {
				throw new IllegalArgumentException("Null or empty argument passed");
			}
		}
	}
}
